package com.ruoyi.system.config;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.stereotype.Component;

import java.util.concurrent.ThreadLocalRandom;

@Component
public class CustomIdGenerator implements IdentifierGenerator {


    @Override
    public Number nextId(Object entity) {
        return null;
    }

    @Override
    public String nextUUID(Object entity) {
        ThreadLocalRandom random = ThreadLocalRandom.current();
        return new UUID(random.nextLong(), random.nextLong()).toString().replace("-", "").substring(10);
    }
}